/*
 * loadingDialog.java
 *
 * Created on 9 de septiembre de 2008, 19:29
 */

package org.perfectday.dashboard.gui;

import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import javax.swing.JTextArea;
import org.perfectday.core.asf.State;

/**
 *
 * @author  Lobo
 */
public class LoadingDialog extends java.awt.Dialog {

    /** Creates new form loadingDialog */
    public LoadingDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        jProgressBar1.setIndeterminate(true);
        this.setLocation(GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint());
        this.setTitle("Cargando partida....");
        jProgressBar1.setMaximum(7);
        jProgressBar1.setValue(0);
        jProgressBar1.setIndeterminate(false);
    }

    public void addState(State actual) {
        this.info.setText("\nEstado actual: "+actual.getMovements().get(0).getName());
        this.jProgressBar1.setValue(this.jProgressBar1.getValue()+1);
    }

    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jProgressBar1 = new javax.swing.JProgressBar();
        info = new javax.swing.JLabel();

        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                closeDialog(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Cargando....."));
        jPanel1.setLayout(new java.awt.BorderLayout());
        jPanel1.add(jProgressBar1, java.awt.BorderLayout.CENTER);

        info.setText(" ");
        jPanel1.add(info, java.awt.BorderLayout.PAGE_END);

        add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /** Closes the dialog */
    private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
        setVisible(false);
        dispose();
    }//GEN-LAST:event_closeDialog

   
   public void closeWindows(){
       this.setVisible(false);
       this.dispose();
       
   }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel info;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JProgressBar jProgressBar1;
    // End of variables declaration//GEN-END:variables

}
